# -*- coding: utf-8 -*-
# @Time    : 2024/11/20 11:39
# @Author  : jay
# @Desc    :
"""hr URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.urls import re_path
from lab.device.superuser_views import SuperUserAppointmentOperationViewSet, SuperUserAppointmentViewSet, SuperUserDeviceViewSet, SuperUserViewSet
from lab.device.views import AppointmentCancelViewSet, AppointmentViewSet, FileViewSet, LabViewSet, MaterialViewSet

urlpatterns = [
    re_path(r'^labs/appointments/cancel/(?P<id>\d+)$', AppointmentCancelViewSet.as_view({'put': 'update'}), name='取消预约设备'),
    re_path(r'^labs/appointments/(?P<id>\d+)$', AppointmentViewSet.as_view({'get': 'retrieve', 'put': 'update'}), name='预约设备'),
    re_path(r'^labs/(?P<id>\d+)$', LabViewSet.as_view({'get': 'retrieve'}), name='实验室详情'),
    re_path(r'^labs$', LabViewSet.as_view({'get': 'list'}), name='实验室列表'),
    re_path(r'^labs/upload$', FileViewSet.as_view({'post': 'create'}), name='实验室文件上传'),
    re_path(r'^labs/appointments$', AppointmentViewSet.as_view({'post': 'create', 'get':'list'}), name='预约设备'),
    re_path(r'^labs/materials$', MaterialViewSet.as_view({'get': 'list'}), name='获取耗材列表'),
    re_path(r'^superuser/appointments/(?P<id>\d+)$', SuperUserAppointmentOperationViewSet.as_view({'put': 'update'}), name='同意或拒绝预约'),
    re_path(r'^superuser/labs$', SuperUserViewSet.as_view({'get': 'list'}), name='管理员页面'),
    re_path(r'^superuser/appointments$', SuperUserAppointmentViewSet.as_view({'get': 'list'}), name='管理员预约审批页面'),
    re_path(r'^superuser/devices/(?P<id>\d+)$', SuperUserDeviceViewSet.as_view({'put': 'update'}), name='管理员设置设备维护'),
]



